package sync.demo04;

/**
 * 第一把锁 - 有一把锁对象为：ONE_LOCK
 *
 * @author lwj
 * @date 2025-03-13
 * @vesion 1.0.0
 */
public class OneThread extends Thread{
    /**
     * 第一把锁
     */
    public static final Object ONE_LOCK = new Object();
    @Override
    public void run() {
        synchronized (ONE_LOCK){
            System.out.printf("获得第一把锁%s,执行相关的业务代码！","ONE_LOCK");

            synchronized (TwoThread.TWO_LOCK) {
                System.out.printf("获得第二把锁%s,执行相关的业务代码！", "TWO_LOCK");
            }
        }
    }
}
